import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from "vuex-persistedstate";
Vue.use(Vuex)

const store=new Vuex.Store({
    state:{
        count:1,
        token:'',
        userinfo:undefined,
    },
    mutations:{
        increate(state,step){
            state.count+=step;
        },
        changeToken(state,token){
            state.token=token
        },
        setUserinfo(state,userinfo){
            state.userinfo=userinfo
        }

    },
    plugins: [createPersistedState({
        key:'vuedemo'
    })],
})
export default store;